# Contributor: Sodface <sod@sodface.com>
# Maintainer: Sodface <sod@sodface.com>
pkgname=sdcv
pkgver=0.5.3
pkgrel=0
pkgdesc="Console version of StarDict"
url="https://dushistov.github.io/sdcv/"
license="GPL-2.0-or-later"
arch="all"
makedepends="cmake glib-dev readline-dev zlib-dev"
checkdepends="jq"
subpackages="$pkgname-doc $pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/Dushistov/sdcv/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTS=True \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	mkdir build/locale
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
73a305baad74d0584912e115d3de7395c8e88745fb69b4e5f1a345061629b0d4e05898bd589e96ce07948d52ba7c508ec4ab77862c8fadca5a2f19c5244e1442  sdcv-0.5.3.tar.gz
"
